<template>
  <div class="g-wrap f-cb">
    <div class="u-title f-cb" style="padding-left: 0">
      <h3><span class="f-ff2">我的电台（{{ DJdata.length}} ）</span></h3>
    </div>
    <ul class="n-favrdi f-cb j-flag" >
      <li class="z-flag"  v-for="(item , index) in DJdata" :key="index">
        <a href="javascript:;" class="cvr u-cover u-cover-3 f-fl"
          ><img
            :src="item.picUrl"
          /><i class="u-bub u-bub-1" v-if="item.newProgramCount"><b class="f-alpha"></b ><em >{{item.newProgramCount > 99 ? '99+' :item.newProgramCount}}</em></i></a
        >
        <div class="col cnt f-pr"  @mouseenter="flag = index" @mouseleave="flag = false">
          <h3 class="f-fw0 f-fs1 f-thide">
            <a href="javascript:;" class="s-fc1">{{item.name}}</a>
          </h3>
          <p class="col s-fc4">
            by &nbsp;<a href="javascript:;" class="s-fc4"
              >{{item.dj.nickname}}</a
            >
          </p>
          <div :class="['opt' , {'hshow':index === flag}]" >
            <span
              class="icn u-icn2 u-icn2-share"
              >分享</span
            ><span
              class="icn u-icn2 u-icn2-del" @click="del(item.id,item.index)"
              >删除</span
            >
          </div>
        </div>
        <div class="col no s-fc4">328期</div>
      </li>
      
    </ul>
  </div>
</template>
<script>
import { DJ } from "../../../network/dj";
import {sub} from "../../../network/dj"
export default {
  data() {
    return {
      DJdata: [],
      flag:""
    };
  },
  methods:{
     del(id,index){
        sub(id,0).then(res => {
            console.log(res)
           if(res.data.code == 200){  
             this.DJdata.splice(index , 1)   
           } 
         },err =>{
           console.log("删除失败")
         })
     },
     res(){
       DJ().then(
          (res) => {
            console.log("我被调用了")
            this.DJdata = res.data.djRadios;
          },
          (  err) => {
            console.log("电台的订阅列表失败");
          }
      );
   },
  },
   created() {
     this.res()
  },
};
</script>

<style scoped>
.g-wrap {
  padding: 40px;
}
.u-title {
  height: 40px;
  border-bottom: 2px solid #c20c0c;
}
h3 {
  padding: 0px;
  margin: 0px;
}
h4 {
  margin: 0px;
  padding: 0px;
}
.u-title h3 {
  float: left;
  font-size: 24px;
  font-weight: normal;
  color: #333;
  font-family: Arial, Helvetica, sans-serif;
}
.f-ff2 {
  font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif;
}
.f-cb::after {
    clear: both;
    content: '.';
    display: block;
    height: 0;
    visibility: hidden;
}
.n-favrdi {
    margin-bottom: 24px;
}
.n-favrdi li {
    float: left;
    width: 100%;
    height: 50px;
    padding: 10px 0;
    border-bottom: 1px solid #e7e7e7;
    line-height: 50px;
}
.u-cover-3 {
    width: 50px;
    height: 50px;
}
.u-cover {
    position: relative;
    display: block;
}
.f-fl {
    float: left;
}
.u-cover img {
    display: block;
    width: 100%;
    height: 100%;
}
.n-favrdi .cvr .u-bub-1 {
    right: -15px;
}
.n-favrdi .cvr .u-bub {
    position: absolute;
    top: -10px;
}
.u-bub-1{
    width: 29px;
}
.u-bub {
    display: block;
    zoom: 1;
    height: 22px;
    color: #fff;
    text-align: center;
    line-height: 23px;
    font-weight: bold;
}
.u-bub-1 b {
    width: 29px;
    background: url("../../../assets/imgs/bub2.png") no-repeat;
}
.u-bub b {
    position: absolute;
    top: 0;
    left: 0;
    height: 22px;
}
.u-bub em {
    float: none;
    display: block;
    position: relative;
    text-align: center;
    z-index: 2;
    font-style: normal;
    font-family: Arial, Helvetica, sans-serif;
}
.n-favrdi .cnt {
    width: 488px;
    padding-right: 57px;
    line-height: 24px;
}
.n-favrdi .col {
    float: left;
    margin-left: 10px;
}
.f-pr {
    position: relative;
    zoom: 1;
}
.f-thide {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-wrap: normal;
}
.f-fw0 {
    font-weight: normal;
}
p{margin: 0px; padding: 0px;}
.f-fs1 {
    font-size: 14px;
}
.s-fc1 {
    color: #333;
}
.n-favrdi .col .col {
    margin-left: 0px;
}
.n-favrdi .col {
    float: left;
    color: #999;
    font-size: 12px;
    font-family: Arial, Helvetica, sans-serif;
}
.s-fc4{
    color: #999;
}

.n-favrdi .cnt .opt {
    position: absolute;
    top: 50%;
    right: 0;
    margin-top: -6px;
    opacity: 0;
}
.n-favrdi .cnt .hshow{
    opacity: 1;
}
.n-favrdi .cnt .opt .icn {
    float: right;
    margin-right: 10px;
    text-indent: -9999px;
    cursor: pointer;
}
.u-icn2{
    display: inline-block;
    overflow: hidden;
    vertical-align: middle;
    background: url("../../../assets/imgs/icon2.png");
}
.u-icn2-share {
    width: 16px;
    height: 14px;
    background-position: -90px 0;
}
.u-icn2-del {
     width: 16px;
    height: 14px;
    background-position: -130px 0;
}
</style>